1. Field of the Invention
The present invention relates to a microcontroller, particularly to a microcontroller which performs authentication by using an encrypted random number.
2. Description of the Related Art
In apparatuses using replaceable accessories such as a battery of a mobile phone and an ink cartridge of a printer, there is a case that an unauthorized accessory and an ordinary accessory are used even though an authorized accessory should be preferably used. In order to prevent the usage of accessories other than authorized accessories as described above, there is a case that authentication is performed between a main body and an accessory. As one of the techniques related to the authentication between the main body and the accessory, the same random number is encrypted between an authenticating side and an authenticated side by an encryption program including the same encryption key and a comparison is performed to confirm coincidence.
A conventional technique to encrypt a random number is described in Japanese Laid Open Patent Application (JP-P2003-318894A) in which an authentication method between apparatuses of a challenge and response system. In this conventional authentication method, a challenge data is transmitted to a terminal from a server, and a response data decrypted from the challenge data is transmitted from the terminal to the server. Further, whether the response data is data decrypted from the challenge data is determined on the basis of encryption performed in the server. When the determination result is affirmative, this authentication method updates a parameter used for both encryption and decryption to a new parameter which is set as a parameter to be used in the next authentication.
If a conventional technique is applied to an application system on which a microcontroller is mounted, it is possible to perform encryption in an accessory other than an authorized accessory by making a copy of entire data of a program memory in which a user program is stored, because an encryption key used for encrypting a random number is directly written into the program or stored as data in a memory which is simultaneously used for storing the program. That is, if an authentication program is illegally obtained and the program is written into a program memory of the microcontroller which is composed of a flash memory or the like, an operation is performed even in an unauthorized accessory, causing a problem of a counterfeit product to be undetectable. In this way, if a microcontroller written by the same program is mounted on a counterfeit product imitating the authorized accessory, the same operation with the authorized accessory is exhibited.